﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserInformation.aspx.cs" Inherits="Liguo.Administration.UserInformation" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>用户信息</title>
    <style type="text/css">
        .auto-style1 {
            height: 40px;
        }
    </style>
     <script type="text/javascript">
         function CheckInput() {
             var objun = document.getElementById("username");
             var valueun = objun.checked;
             var objmb = document.getElementById("mailbox");
             var valuemb = objmb.checked;
             var pass = true;
             pass = !isEmpty("InputUser");
             var mbpass = true;
             mbpass = !isEmpty("InputMail");
             if (valueun) {
                 if (!pass) {
                     alert('请填写用户名');
                     return false;
                 }
             }
             if (valuemb) {
                 if (!mbpass) {
                     alert('请填写邮箱');
                     return false;
                 } else if (!isValid("InputMail", /^\w{1,15}(?:@(?!-))(?:(?:[a-z0-9-]*)(?:[a-z0-9](?!-))(?:\.(?!-)))+[a-z]{2,4}$/)) {
                     alert('邮箱输入错误！');
                     return false;
                 }
             }
         }
         function isEmpty(name) {
             return document.getElementById(name).value == "";
         }
         function isValid(name, pat) {
             var s = document.getElementById(name).value;
             return pat.exec(s);
         }
         function selectedChange()
         {
             //var gv = document.getElementById("<%=GridView1.ClientID %>");
             //var ddl = gv.getElementsByClassName("status");
             //var ddlSelectValue = ddl.options[ddl.selectedIndex].value;
             var value = 1;
             if (value == 0)
             {
                 if (confirm("确定要禁用?") == false)
                 {
                    
                 }
             }
         }
         </script>
</head>
<body>
    <form id="form1" runat="server">
     <table>
         <tr>
             <td><asp:CheckBox ID="username" runat="server" Checked="true"/></td>
             <td><asp:Label ID="Label1" runat="server" Text="用户名:"></asp:Label></td>
             <td><asp:TextBox ID="InputUser" runat="server"></asp:TextBox></td>
         </tr>
         <tr>
               <td class="auto-style1"><asp:CheckBox ID="mailbox" runat="server" Checked="true"/></td>
                 <td><asp:Label ID="Label2" runat="server" Text="邮箱:"></asp:Label></td>
             <td class="auto-style1"><asp:TextBox ID="InputMail" runat="server" ></asp:TextBox></td>
         </tr>
     </table>
        <asp:Button ID="search" runat="server" Text="搜索" OnClick="search_Click" OnClientClick="return CheckInput()"/>
    <div>
    
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
                        ForeColor="#333333" GridLines="Horizontal" DataKeyNames="ID">
                        <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                        <Columns>
                            <asp:BoundField DataField="ID" HeaderText="用户ID" ReadOnly="True" />
                            <asp:BoundField DataField="UserName" HeaderText="用户名" ReadOnly="True" />
                            <asp:BoundField DataField="MailBox" HeaderText="邮箱" ReadOnly="True" />
                            <asp:TemplateField HeaderText="状态">
                                <ItemTemplate>
                                    <asp:DropDownList ID="DropDownList1" runat="server" DataValueField="Status" AutoPostBack="true" 
                                        OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                                      <asp:ListItem Value="0">禁用</asp:ListItem>
                                      <asp:ListItem Value="1">启用</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="Score" HeaderText="积分" ReadOnly="True" />
                            <asp:BoundField DataField="Reputation" HeaderText="信誉度" ReadOnly="True" />
                        </Columns>
                        <RowStyle ForeColor="#000066" />
                        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                    </asp:GridView>
    
    </div>
    </form>
</body>
</html>
